<?php
require_once dirname(__FILE__).'/minBot.php';

set_time_limit(0);

// sql layer - http://dibiphp.com
dibi::connect(array(
    'hostname' => '127.0.0.1',
    'username' => '',
    'password' => '',
    'charset' => 'utf8',
    'database' => '',
    'driver' => 'mysql'
) );

do{
    $bot = new minBot;
    try{
        $bot->registerPlugin('Auth');
        $bot->registerPlugin('Control');
        
        $bot->connect('server', 5222, 'username', 'password');
        $bot->loginToRoom('room@server', 'minBot');
        $bot->deadLastMessages();

        $bot->run();
        $bot->shutdown();

    } catch(minBotException $e) {
        echo "------ Exception:".$e->getMessage()."\n";
    }

} while($bot->needRestart);